package com.situ.crm.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import com.situ.crm.interceptor.LoginInterceptor;

//springmvc的配置类
@Configuration
public class MySpringMVCConfig implements WebMvcConfigurer {

	// 在springmvc中注册拦截器
	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		registry.addInterceptor(new LoginInterceptor()).addPathPatterns("/**").excludePathPatterns("/login", "/js/**", "/css/**", "/img/**", "/plugins/**", "/i18n");
	}

	@Bean
	public LocaleResolver localeResolver() {
		return new MyLocaleResolver();
	}

}
